Class("Array")

function __Constructor(self)
	self:Clear()
end

function Add(self,element)
	table.insert(self._List, element)
end

function Remove(self,element)
    local rmCount = 0
    for i = 1, self:Len() do
        local ele = self:Get(i)
        if ele == element then
            self:RemoveAt(i-rmCount)
        end
    end
end

function RemoveAt(self,index)
    table.remove(self._List,index)
end

function ForEach(self,each)
	if type(each) == "string" then
		for _,element in pairs(self._List) do
			element:SafeCall(each)
		end
	elseif type(each) == "function" then
		for _,element in pairs(self._List) do
			each(element)
		end
	end
end

function Clear(self)
	self._List = {}
end

function Get(self,index)
	return self._List[index]
end

function Len(self)
	return #self._List
end

function IsEmpty(self)
    return self:Len() > 0
end